# 代码 3-10 传土豆模拟程序
from pythonds.basic import Queue
def hotPotato(namelist, num):
    q = Queue();
    for name in namelist:
        q.enqueue(name)
    while q.size()>1:
        for _ in range(num):
            q.enqueue(q.dequeue())
        q.dequeue()
    return q.dequeue()

h=hotPotato(['bill','Brad','kent',"jane","susan","David"],7)
print(h)